package com.service.Impl;

import com.exception.GlobalException;
import com.mapper.ConcernMapper;
import com.service.ConcernService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * ClassName: ConcernDaoImpl
 * Description:
 *
 * @author L_Z_R
 * @create 2025/04/16 16:25
 * @version 1.0
 */
@Service
public class ConcernServiceImpl implements ConcernService {
    @Autowired
    private ConcernMapper concernMapper;
    @Override
    public void addConcern(Integer accountId, Integer concernId) {
        try {
            concernMapper.addConcern(accountId,concernId);
        } catch (Exception e) {
            throw new GlobalException(1001,"关注失败");
        }
    }

    @Override
    public void deleteConcern(Integer accountId, Integer concernId) {
        try {
            concernMapper.deleteConcern(accountId,concernId);
        } catch (Exception e) {
            throw new GlobalException(1001,"取消关注失败");
        }
    }

    @Override
    public int getConcernCountByAccountId(Integer accountId) {
        return concernMapper.getConcernCountByAccountId(accountId);
    }

    @Override
    public int getConcernedCountByAccountId(Integer accountId) {
        return concernMapper.getConcernedCountByAccountId(accountId);
    }
}
